/*
ID:luongho3
LANG:JAVA
TASK:starry
*/
import java.io.File;
import java.io.PrintStream;
import java.util.Queue;
import java.util.Scanner;
import java.util.concurrent.ArrayBlockingQueue;


public class starry {

	int W,H;
	int[][] m = new int[200][200];
	char[][] r = new char[200][200];
	boolean[][] visited = new boolean[200][200];
	cluster[] cs = new cluster[200000];
	int ncl;

	public static void main(String[] args) throws Exception {

		starry prob = new starry();
		prob.read();
		prob.solve();
	}
	
	public void read() throws Exception {
		Scanner scanner = new Scanner(new File("starry.in"));
		W = scanner.nextInt();
		H = scanner.nextInt();
		for (int i=1;i<=H;++i) {
			String str = scanner.next();
			for (int j=1;j<=W;++j) {
				m[i][j] = str.charAt(j-1) -'0';
				r[i][j] = '0';
			}
		}
	}
	
	public void solve() throws Exception {
		PrintStream ps = new PrintStream(new File("starry.out"));
		System.setOut(ps);
		Queue<Integer> qu = new ArrayBlockingQueue<Integer>(300000);
		int up, down, left, right;
		ncl = 0;
		for (int i=1;i<=H;++i) {
			for (int j=1;j<=W;++j) {
//				if (i==2 && j ==10) {
//					System.out.println("Here");
//				}
				up = H;
				down = 1;
				left = W;
				right = 1;
				if (m[i][j] == 1 && !visited[i][j]) {
					qu.add(i);
					qu.add(j);
					ncl++;
					while (!qu.isEmpty()) {
						int h = qu.poll();
						int w = qu.poll();
						visited[h][w] = true;
						m[h][w] = -ncl;
						if (h < up) up = h;
						if (h > down) down = h;
						if (w < left) left = w;
						if (w > right) right = w;
						for (int x=-1;x<=1;++x) {
							for (int y=-1;y<=1;++y) {
								if (x!=0 || y!=0) {
									if (h+y >= 1 && h+y <= H) {
										if (w+x >= 1 && w+x <= W) {
											if (m[h+y][w+x] == 1) {
												if (!visited[h+y][w+x]) {
													qu.add(h+y);
													qu.add(w+x);
													visited[h+y][w+x] = true;
													m[h+y][w+x] = -ncl;
												}
											}
										}
									}
								}
							}
						}
					}
					
					cs[ncl] = new cluster(up, down, left, right, m, -ncl); 
				}
			}
		}
//		int w = cs[1].right-cs[1].left+1;
//		int h = cs[1].down-cs[1].up+1;
//		print(cs[1].map, w, h);
//		cs[1].map = cluster.mirror(cs[1].map, w, h);
//		print(cs[1].map, h, w);
//		cs[1].map = cluster.rotate(cs[1].map, h, w);
//		print(cs[1].map, w, h);
//		cs[1].map = cluster.mirror(cs[1].map, w, h);
//		print(cs[1].map, h, w);
//		cs[1].map = cluster.rotate(cs[1].map, h, w);
//		print(cs[1].map, w, h);
		char c = 'a';
//		System.out.println(ncl);
		for (int i=1;i<=ncl;++i) {
			if (cs[i].c == ' ') {
//				if (c == 'd') {
//					System.out.println("Here");
//				}
				cs[i].c = c;
				cs[i].setBigMap(r);
				for (int j=i+1;j<=ncl;++j) {
//					System.out.println(i + " " + j);
//					if (i == 4 && j == 13) {
//						System.out.println(cs[i]);
//						System.out.println(cs[j]);
//					}
					if (cs[j].isSimilar(cs[i])) {
						cs[j].c = cs[i].c;
						cs[j].setBigMap(r);
					}
				}
				c++;
			}
		}
		for (int i=1;i<=H;++i) {
			for (int j=1;j<=W;++j) {
				System.out.print(r[i][j]);
			}
			System.out.println();
		}
		
		ps.close();
	}

//	private static void print(int[][] map, int w, int h) {
//		for (int i=1;i<=h;++i) {
//			for (int j=1;j<=w;++j) {
//				System.out.print(map[i][j]);
//			}
//			System.out.println();
//		}
//		System.out.println();
//	}
	
}
class cluster {
	char c;
	int up, down, left, right, ncl;
	int[][] map;
	cluster(int up, int down, int left, int right, int[][] bigmap, int ncl) {
		this.ncl = ncl;
		this.up = up;
		this.down = down;
		this.left = left;
		this.right = right;
		this.map = new int[down-up+2][right-left+2];
		for (int i=up;i<=down;++i) {
			for (int j=left;j<=right;++j) {
				if (bigmap[i][j] == ncl) {
					map[i-up+1][j-left+1] = 1;
				}
			}
		}
		this.c = ' ';
	}
	
	public void setBigMap(char[][] r) {
		for (int i=up;i<=down;++i) {
			for (int j=left;j<=right;++j) {
				if (map[i-up+1][j-left+1] == 1) {
					if (r[i][j] == '0') {
						r[i][j] = c;
					}
				}
			}
		}
		
	}

	public boolean isSimilar(cluster clu) {
		int w1 = this.right - this.left + 1;
		int h1 = this.down - this.up + 1;
		int w2 = clu.right - clu.left + 1;
		int h2 = clu.down - clu.up + 1;
		int[][] ma = new int[h2+1][w2+1];
		for (int i=1;i<=h2;++i) {
			for (int j=1;j<=w2;++j) {
				ma[i][j] = clu.map[i][j];
			}
		}
		for (int i=1;i<=4;++i) {
			if (identical(this.map,ma,w1,h1,w2,h2)) {
				return true;
			}
			else {
				ma = cluster.rotate(ma, w2, h2);
				int tmp = w2;
				w2 = h2;
				h2 = tmp;
			}
		}
		ma = cluster.mirror(ma, w2, h2);
		for (int i=1;i<=4;++i) {
			if (identical(this.map, ma,w1,h1,w2,h2)) {
				return true;
			}
			else {
				ma = cluster.rotate(ma, w2, h2);
				int tmp = w2;
				w2 = h2;
				h2 = tmp;
			}
		}
		return false;
	}
	
	public static boolean identical(int[][] m, int[][]n, int w1, int h1, int w2, int h2) {
		if (w1 == w2 && h1 == h2) {
			int w = w1;
			int h = h1;
			for (int i=1;i<=h;++i) {
				for (int j=1;j<=w;++j) {
					if (m[i][j] != n[i][j]) {
						return false;
					}
				}
			}
			return true;
		}
		else {
			return false;
		}
	}
	
	public static int[][] rotate(int[][] m, int w, int h) {
		int[][] re = new int[w+1][h+1];
		for (int i=1;i<=w;++i) {
			for (int j=1;j<=h;++j) {
				re[i][j] = m[j][w+1-i];
			}
		}		
		return re;
	}
	
	public static int[][] mirror(int[][] m, int w, int h) {
		int[][] re = new int[h+1][w+1];
		for (int i=1;i<=h;++i) {
			for (int j=1;j<=w;++j) {
				re[i][j] = m[i][w-j+1];
			}
		}		
		return re;
	}

	public String toString() {
		String result = "";
		result += (up + " " + down + " " + left + " " + right + "\n");
		for (int i=1;i<=down-up+1;++i) {
			for (int j=1;j<=right-left+1;++j) {
				result += (map[i][j]);
			}
			result += "\n";
		}
		
		return result;
	}
}